<script setup lang="ts">
import { RouterView } from 'vue-router'
import { computed, reactive } from 'vue'
import zhCn from 'element-plus/lib/locale/lang/zh-cn'
import en from 'element-plus/lib/locale/lang/en'
import { useLangStore } from '@/stores/index'
const lang = useLangStore()
interface localesType {
  [zh: string]: Object
}
const locales = reactive<localesType>({
  zh: zhCn,
  en: en
})
const locale = computed(() => {
  // 不添加localesType这个接口，ts会报错
  return locales[lang.language]
})
</script>

<template>
  <el-config-provider :locale="locale">
    <RouterView />
  </el-config-provider>
</template>

<style lang="scss" scoped></style>
